/**
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2021 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@use "sass:map";

$colors: (
  "primary": #428bca,
  "warning": #f0ad4e,
  "success": #5cb85c,
  "danger": #d9534f,
  "error": #b94a48,
  "info": #5bc0de,
  "red": #f44336,
  "pink": #e91e63,
  "purple": #9c27b0,
  "deeppurple": #673ab7,
  "indigo": #3f51b5,
  "blue": #2196f3,
  "lightblue": #03a9f4,
  "cyan": #00bcd4,
  "teal": #009688,
  "green": #4caf50,
  "lightgreen": #8bc34a,
  "lime": #cddc39,
  "yellow": #ffeb3b,
  "amber": #ffc107,
  "orange": #ff9800,
  "deeporange": #ff5722,
  "brown": #795548,
  "grey": #9e9e9e,
  "bluegrey": #607d8b,
  "black": black,
  "white": white,
  "olive": #cddc39,
  "violet": #9c27b0,
);

$text: (
  "primary": #fff,
  "warning": #fff,
  "success": #fff,
  "danger": #fff,
  "error": #fff,
  "info": #fff,
  "red": #fff,
  "pink": #fff,
  "purple": #fff,
  "deeppurple": #fff,
  "indigo": #fff,
  "blue": #fff,
  "lightblue": #fff,
  "cyan": #fff,
  "teal": #fff,
  "green": #fff,
  "lightgreen": #000,
  "lime": #000,
  "yellow": #000,
  "amber": #000,
  "orange": #000,
  "deeporange": #fff,
  "brown": #fff,
  "grey": #000,
  "bluegrey": #fff,
  "black": white,
  "white": black,
  "olive": #000,
  "violet": #fff,
);

$text_styles: (
  "bold": (
    "font-weight": "600",
  ),
  "italic": (
    "font-style": "italic",
  ),
  "underline": (
    "text-decoration": "underline",
  ),
  "overline": (
    "text-decoration": "overline",
  ),
  "line-through": (
    "text-decoration": "line-through",
  ),
  "small": (
    "font-size": "10px",
  ),
  "big": (
    "font-size": "16px",
  ),
  "large": (
    "font-size": "18px",
  ),
  "left": (
    "text-align": "left",
  ),
  "right": (
    "text-align": "right",
  ),
  "center": (
    "text-align": "center",
  ),
  "justify": (
    "text-align": "justify",
  ),
);

$label_colors: (
  "red": red,
  "blue": blue,
  "green": green,
  "muted": #777,
  "primary": #428bca,
  "success": #3c763d,
  "info": #31708f,
  "warning": #8a6d3b,
  "danger": #a94442,
);

$label_backgrounds: (
  "primary": #428bca,
  "success": #dff0d8,
  "info": #d9edf7,
  "warning": #fcf8e3,
  "danger": #f2dede,
);

$label_backgrounds_text: (
  "primary": #fff,
);

[class*="hilite-"] > .display-text {
  color: inherit;
}

[class*="hilite-"].strong {
  &,
  input:first-of-type,
  textarea:first-of-type {
    font-weight: 600 !important;
  }
}

@each $name, $value in $colors {
  .hilite-#{$name}-text,
  .hilite-#{$name}-text input:first-of-type,
  .hilite-#{$name}-text textarea:first-of-type,
  .hilite-#{$name}-text .slick-cell {
    color: $value !important;
  }

  .slick-row[class*="hilite-"] .slick-cell.hilite-#{$name}-text {
    color: $value !important;
  }

  .hilite-#{$name},
  .hilite-#{$name} input:first-of-type,
  .hilite-#{$name} textarea:first-of-type,
  .hilite-#{$name} .slick-cell {
    color: map.get($text, $name);
    background-color: $value;
  }

  .slick-row[class*="hilite-"] .slick-cell.hilite-#{$name} {
    color: map.get($text, $name);
    background-color: $value;
  }
}

.slick-row[class*="hilite-"] {
  .selected,
  .slick-cell.selected {
    background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2));
  }
}

.slick-row[class*="-text"] {
  .selected,
  .slick-cell.selected {
    background-image: none;
  }
}

.slickgrid-editable
  .slick-row[class*="hilite-"].active
  .slick-cell-editable:before,
[class*="hilite-"].form-item-container {
  background-color: inherit !important;
}

@each $name, $value in $label_colors {
  .form-item label.label-#{$name},
  .form-item-container.#{$name},
  .form-item-container.#{$name} input:first-of-type,
  .form-item-container.#{$name} input:first-of-type {
    color: $value !important;
  }
}

@each $name, $value in $label_backgrounds {
  .form-item label.label-bg-#{$name},
  .form-item-container.bg-#{$name},
  .form-item-container.bg-#{$name} input:first-of-type,
  .form-item-container.bg-#{$name} textarea:first-of-type {
    color: map.get($label_backgrounds_text, $name);
    background-color: $value !important;
  }
}

.font-bold {
  font-weight: 600;
}
.font-noraml {
  font-weight: 400;
}

@each $name, $value in $colors {
  .fg-#{$name} {
    color: $value;
  }
}

@each $name, $value in $colors {
  .bg-#{$name} {
    background-color: $value;
  }
}

@each $name, $value in $colors {
  .bg-#{$name} {
    background-color: $value;
  }
}

@each $name, $value in $colors {
  .panel-#{$name} .panel .panel-header,
  .panel-#{$name} .dashlet .dashlet-header {
    border-top-color: $value;
  }
}
